# -*- coding: utf-8 -*-
"""
author:码同学 极光
date:2023-06-10
desc: 
sample: 
"""
class Student:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def info(self):
        message = "我叫{}，今年{}岁".format(self.name, self.age)
        print(message)

    def __str__(self) -> str:
        return f"{self.name}"


class Classes:
    #多个学生？
    def __init__(self,clz_id,clz_name) -> None:
        self.id = clz_id
        self.name = clz_name
        self.__students = []

    #代码之间相对调用 接口
    # http 请求 接口
    def add(self,stu):
        self.__students.append(stu)

    def info(self):
        for item in self.__students:
            print(item)
            #print(item.name,item.age)
            #print(item.__dict__)


#http接口
if __name__ == '__main__':
   stu1= Student('张三',15)
   stu2 = Student('李四', 20)
   clz1 = Classes("001",'一班')
   clz1.add(stu1)
   clz1.add(stu2)
   # clz1.students.append(stu1)
   # clz1.students.append(stu2)
   clz1.info()

   stu3 = Student('mtx_1', 15)
   stu4 = Student('mtx_2', 20)
   clz2 = Classes("002", '二班')
   clz2.add(stu3)
   clz2.add(stu4)
   clz2.info()
